<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" href="../../libs/mui.min.css"/>
    <link rel="stylesheet" href="../../libs/app.css"/>
    <link rel="stylesheet" href="../../css/main.css"/>
    <link rel="stylesheet" href="../../css/fast.css"/>
    <style>
        #askfor {
            margin-top: 10px;
        }
    </style>
</head>

<body>
<div class="head">
    <img class="mui-action-back" src="../../images/all-left.png" alt="">
    <p>快速贷款</p>
</div>
<div class="context" id="context">

    <!--<div class="context-d">
    <img src="../../images/fast-back.png" alt="" width="90%">
    <button id="askfor" onclick="href('askfor.html','askfor')">申请贷款</button>
</div>-->
    <!--<p class="more">点击加载更多</p>-->
</div>

<script src="../../libs/mui.min.js"></script>
<script src="../../js/jquery-3.1.1.min.js"></script>
<script src="../../js/url.js"></script>
<script>
    mui.init()
    var page = 1;
    fast();

    function fast() {
        $.ajax({
            url: ur + 'rest/quickLoanController/list',
            type: 'GET',
            dataType: 'json',
            data: {
                page: page,
            },
            success: function (data) {
                var infomation = data.data.list;
                var i = 0;
                var s = infomation.length;
                var totalPage = Math.ceil(data.data.total / 10);
                if (data.meta.code == 'S002') {
                    if (totalPage >= page) {
                        for (i; i < s; i++) {
                            var list = $('<div class="context-d">' +
                                '<img src="' + ur + infomation[i].image + '" alt="" width="90%">' +
                                '<button id=' + infomation[i].id + ' partner=' + infomation[i].partnerId + ' class="asffor" loanCode=' + infomation[i].loanCode + '>申请贷款</button>' +
                                '</div>');
                            $('.context').append(list);
                        }
                    }
                    var more = '<p class="more">点击加载更多</p>';
                    if (page < totalPage && $('.more').length == 0) {
                        $('#context').append(more);
                        $('.more').text('点击加载更多');
                        $('#context').on('tap', '.more', function () {
                            page++;
                            $(this).remove()
                            fast();
                        })
                    } else {
                        $('#context').append(more);
                        $('.more').text('已无更多');
                    }

                } else {
                    mui.toast(data.meta.message);
                }
            }
        })
    }

    //点击跳转贷款页面
    $('#context').on('tap', '.asffor', function () {
        localStorage.dk_type = 2;
        localStorage.fastPassAskfor = 'true'; // 快速贷标识
        localStorage.fast_id = $(this).attr('id');
        localStorage.fast_partner = $(this).attr('partner');
        href('fast-loanSelect.html', 'fast-loanSelect');
        /*switch ($(this).attr('loanCode')){
         case 'aj':href('askfor-aj.html', 'askfor-aj.html');break;
         case 'card-native':href('askfor-card-native.html', 'askfor-card-native.html');break;
         case 'xyd':href('askfor2.html', 'askfor2.html');break;
         case '2y':href('askfor-2y.html', 'askfor-2y.html');break;
         case 'qcdy':href('askfor-qcdy.html', 'askfor-qcdy.html');break;
         case 'xed':href('s-askfor.html', 's-askfor.html');break;
         case 'fcdy':href('askfor-fcdy.html', 'askfor-fcdy.html');break;
         }*/
//				mui.fire('evaluate', 'fastRecommend', {id:$(this).attr('id')});
    })
</script>
</body>

</html>